﻿<UserControl x:Class="Oxage.Views.ManualView"
  xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
  xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  xmlns:controls="clr-namespace:Oxage.Controls;assembly=Oxage.Controls"
  xmlns:m="clr-namespace:Oxage.Models">
  <UserControl.DataContext>
    <m:ManualViewModel />
  </UserControl.DataContext>
  <Grid x:Name="LayoutRoot" Focusable="True">
    <Border Background="#595959" CornerRadius="3">
      <Grid Margin="4">
        <Grid.RowDefinitions>
          <RowDefinition Height="Auto" />
          <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <!--<TextBlock Grid.Row="0" Text="Remote Control" Style="{DynamicResource HeaderTextStyle}" />-->
        <Border Grid.Row="1" ClipToBounds="True" Margin="0,2,0,0" CornerRadius="3">
          <Border Background="#444444" CornerRadius="3">
            <!--<TextBox x:Name="input" />-->

            <StackPanel Margin="5">
              <!-- Quick move -->
              <!--
              <TextBlock Text="quick move" Style="{StaticResource PhoneTextSmallStyle}" Margin="12,0" />
              <Button Content="change view" Margin="0" Click="QuickMove_Click" />
              -->
            
              <!-- Precise movement control -->
              <StackPanel Margin="0,0,0,10">
                <TextBlock Text="Precise movement control" Margin="0,0,0,3" />
                <ItemsControl ItemsSource="{Binding Axes}">
                  <ItemsControl.ItemsPanel>
                    <ItemsPanelTemplate>
                      <StackPanel Orientation="Vertical" />
                    </ItemsPanelTemplate>
                  </ItemsControl.ItemsPanel>
                  <ItemsControl.ItemTemplate>
                    <DataTemplate>
                      <Grid x:Name="container" Margin="0,0,0,5">
                        <Grid.ColumnDefinitions>
                          <ColumnDefinition Width="Auto" />
                          <ColumnDefinition Width="*" />
                          <ColumnDefinition Width="Auto" />
                          <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>
                        <Button Grid.Column="0" Content="±" Click="ToggleValueSign_Click" Tag="{Binding}" IsEnabled="{Binding CanClick}" />
                        <TextBox Grid.Column="1" Margin="5,0,5,0" Text="{Binding TargetValueFormatted, Mode=TwoWay}" TextAlignment="Right" IsEnabled="{Binding CanClick}" />
                        <Button Grid.Column="2" Content="REL" IsEnabled="{Binding CanClick}" Visibility="{Binding AxisMovement, Converter={StaticResource VisibilityConverter}, ConverterParameter='Relative'}" Tag="{Binding}" Click="Relative_Click" />
                        <Button Grid.Column="2" Content="ABS" IsEnabled="{Binding CanClick}" Visibility="{Binding AxisMovement, Converter={StaticResource VisibilityConverter}, ConverterParameter='Absolute'}" Tag="{Binding}" Click="Absolute_Click" />
                        <Button Grid.Column="3" Margin="5,0,0,0" Content="{Binding MoveButtonName}" Tag="{Binding}" IsEnabled="{Binding CanClick}" Click="PreciseMove_Click" />
                        <!-- TODO: ProgressBar -->
                      </Grid>
                    </DataTemplate>
                  </ItemsControl.ItemTemplate>
                </ItemsControl>
              </StackPanel>

              <!-- Position references -->
              <StackPanel Margin="0,0,0,10">
                <TextBlock Text="Position references" Margin="0,0,0,3" />
                <Grid>
                  <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto" />
                  </Grid.ColumnDefinitions>
                  <ComboBox Grid.Column="0" ItemsSource="{Binding ReferencePoints}" SelectedIndex="{Binding ReferencePointIndex, Mode=TwoWay}" />
                  <Button Grid.Column="1" Content="Move" IsEnabled="{Binding CanMoveToReferencePoint}" Click="ReferencePoint_Click" Margin="5,0,0,0" />
                </Grid>
              </StackPanel>

              <!-- Tool and output pin control -->
              <!--
              <TextBlock Text="tool control" Style="{StaticResource PhoneTextSmallStyle}" Margin="12,20,12,0" />
              <StackPanel Orientation="Horizontal">
        	      <Button Content="-" Margin="0" Width="69" Height="69" />
                <TextBox Text="3000 RPM" Width="200" TextAlignment="Right" />
        	      <Button Content="+" Margin="0" Width="69" Height="69" />
                <Button Content="apply" Margin="0" Height="69" />
              </StackPanel>
              <StackPanel Orientation="Horizontal">
        	      <Button Content="on/off" Margin="0" Height="69" />
                <Button Content="flood" Margin="0" Height="69" />
                <Button Content="relay 1" Margin="0" Height="69" />
                <Button Content="rel2" Margin="0" Height="69" />
              </StackPanel>
              -->

              <!-- Quick Move -->
              <StackPanel Margin="0,0,0,10">
                <TextBlock Text="Quick movement" Margin="0,0,0,3" />
                <ComboBox ItemsSource="{Binding InputControlList}" SelectedIndex="{Binding InputControlIndex, Mode=TwoWay}" />
                <Viewbox Margin="0,10,0,10">
                  <Grid>
                    <Grid.ColumnDefinitions>
                      <ColumnDefinition Width="*" />
                      <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <controls:DualAxisController x:Name="axis1" Grid.Column="0" Position="{Binding PointXY}" IsMouseEnabled="True" HorizontalAlignment="Center" VerticalAlignment="Center" />
                    <controls:DualAxisController x:Name="axis2" Grid.Column="1" Position="{Binding PointZA}" IsMouseEnabled="True" HorizontalAlignment="Center" VerticalAlignment="Center" />
                  </Grid>
                </Viewbox>
              </StackPanel>
              
            </StackPanel>
            
            
            
          </Border>
        </Border>
      </Grid>
    </Border>
	</Grid>
</UserControl>
